package org.mkh.cmd;

import java.util.HashMap;
import java.util.Map;

/**
 * The Class Registry.
 * 
 * Maintains a map of class names to instances of the class
 */
public final class Registry {
// ------------------------------ FIELDS ------------------------------

	/** The Constant objectMap. */
	private static final Map<String, Object> objectMap = new HashMap<String, Object>();

// -------------------------- STATIC METHODS --------------------------

	/**
	 * Put.
	 *
	 * @param obj
	 *            the obj
	 */
	public static final void put(final Object obj) {
		final String key = obj.getClass().getCanonicalName();
		objectMap.put(key, obj);
	}

	/**
	 * Gets the.
	 *
	 * @param key
	 *            the key
	 *
	 * @return the object
	 */
	public static final Object get(final String key) {
		return objectMap.get(key);
	}

// --------------------------- CONSTRUCTORS ---------------------------

	/**
	 * Instantiates a new registry.
	 */
	private Registry() {

	}
}
